<template>
	<view>
		<view class="u-p-l-20 u-p-r-20">
			<el-card>
				<el-button plain @click="onClickLocalhost" size="mini" icon="el-icon-link">localhost</el-button>
				<!-- <el-checkbox v-model="isSlowMotion" :label="isSlowMotion? '慢速':'常速'" border size="mini" @change="changeSlowMotion"></el-checkbox> -->
				<el-button plain @click="onClickRollingResultLog" size="small" >滚轴结果Log</el-button>
				<el-button plain @click="onClickPrize" size="small" >大奖测试</el-button>
			</el-card>
		</view>
		
		<view class="u-p-l-20 u-p-r-20 u-m-t-20">
			<el-card>
				<div slot="header">游戏速率</div>
				  <view class="">
					<el-input-number size="medium" v-model="slowMotion" :min="0" :max="1" :step="0.05" @change="handleChangeSlowMotion"></el-input-number>
				  </view>
			</el-card>
		</view>
		
		<view class="u-p-l-20 u-p-r-20 u-m-t-20">
			<el-card>
				<div slot="header">多语言</div>
				  <el-input placeholder="请输入多语言KEY值" v-model="inputLanguageStr" class="input-with-select" prefix-icon="el-icon-search">
				    <el-button plain slot="append" icon="el-icon-search" @click="onclickLanguageStr">查询输出</el-button>
				  </el-input>
			</el-card>
		</view>
	</view>
</template>

<script>
	export default {
		name:"ui-drawer-more",
		data() {
			return {
				isSlowMotion:false,
				inputLanguageStr:"",
				slowMotion:0.05
			};
		},
		methods: {
			handleChangeSlowMotion(value){
				if(value){
					this._evalCode(
						"window.setSlowMotion(" +
						"'" + value + "'" +
						")");
				}
			},
			onclickLanguageStr(){
				if (this.inputLanguageStr == "") return;
				
				this.$notify({
						title:'',
					  message: '多语言已输出到控制台！',
					  duration:800,
					  type: 'success'
					});
					
				this._evalCode(
					"window.queryLanguageKey(" +
					"'" + this.inputLanguageStr + "'" +
					")");
			},
			changeSlowMotion(v){
				this.isSlowMotion = v;
				let value = v ? 0.05 : 1;
				this._evalCode(
					"window.setSlowMotion(" +
					"'" + value + "'" +
					")");
			},
			onClickRollingResultLog(){
				this.$emit("setMoreDrawer",false);
				
				this.$notify({
						title:'',
					  message: '滚轴结果已输出到控制台！',
					  duration:800,
					  type: 'success'
					});
					
				let code = "window.rollingResultLog()";
				chrome.devtools.inspectedWindow.eval(code);
			},
			onClickLocalhost(){
				this.$emit("setMoreDrawer",false);
				let code = "window.pluginLocalhost()";
				chrome.devtools.inspectedWindow.eval(code);
			},
			onClickPrize() {
				this.$emit("setMoreDrawer",false);
				let code = "window.pluginPlayPrize()";
				chrome.devtools.inspectedWindow.eval(code);
			},
			onClickLookGamelayer(){
				this.$emit("setMoreDrawer",false);
				let value = "CommonMainView";
				this._evalCode(
					"window.pluginLookNode(" +
					"'" + value + "'" +
					")");
				
			}
		}
	}
</script>

<style lang="scss">
	
</style>